﻿
@using (Html.BeginForm("UnzipUpdateFile", "System", Html.ViewContext.RouteData.Values, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <div style="width:100%">
        <div class="error-header" style="width:600px;margin-bottom:1px">车辆管理系统：系统文件更新</div>
        <div class="success-content" style="width:600px">
            <table>
                <tr>
                    <td><input type="file" id="fileImage" name="fileImage" style="width:400px" /> </td>
                    <td>
                        @Html.DevExpress().Button(settings =>
                        {
                            settings.Name = "Button1";
                            settings.Text = "上传";
                            settings.UseSubmitBehavior = false;
                            settings.Width = 70;
                            settings.ControlStyle.CssClass = "button1";
                            settings.ClientSideEvents.Click = "function(s, e){ commit_data();}";
                        }).GetHtml()
                    </td>
                </tr>
            </table>  
        </div>
    </div>

    <script type="text/javascript">
        function commit_data() {
            var file = $("#fileImage").val();
            if (file == null || file == "") {
                alert("请选择要上传的文件。");
                return;
            }
            var extend = file.substring(file.lastIndexOf(".") + 1).toLowerCase();
            
            var allow_ext = "zip|";
            if (allow_ext.indexOf(extend + "|", 0) < 0) {
                alert("该格式的附件不能上传。");
                return;
            }
            document.forms[0].submit();
        };
    </script>
    
}



